// 评论数据

var mongoose = require('mongoose')

mongoose.connect('mongodb://localhost/test', { useMongoClient: true })

var Schema = mongoose.Schema

var commentSchema = new Schema({
    comment: {
        type: String,
        required: true
    },
    // 回复的文章id
    activeId: {
        type: mongoose.Schema.Types.ObjectId,
        required: true
    },
    // 发布这条评论的用户的id
    userId: {
        type: mongoose.Schema.Types.ObjectId,
        required: true
    },
    // 回复文章的作者id
    authorId: {
        type: mongoose.Schema.Types.ObjectId,
        required: true
    },
    dateTime: {
        type: Date,
        default: new Date()
    },
    // email: {
    //     type: String,
    //     required: true
    // },
    // name: {
    //     type: String,
    //     required: true
    // }

})

// 直接导出模型构造函数
module.exports = mongoose.model('Comment', commentSchema)